package com.itheima.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @Description: MyAspect2 外部引入切入点方法类
 * @Author: HH
 * @Date: 2025/4/21 11:17
 **/
@Slf4j
// @Aspect
@Component
@Order(2) // 设置切面类的执行顺序（前置通知：数字越小先执行; 后置通知：数字越小越后执行）
public class MyAspect2 {

    // 前置通知
    // 外部引入切入点方法
    @Before("com.itheima.aspect.MyAspect1.pointCut()")
    public void before(JoinPoint joinPoint) {
        log.info("MyAspect2 =======before()");
    }

    // 后置通知
    @After("com.itheima.aspect.MyAspect1.pointCut()")
    public void after(JoinPoint joinPoint) {
        log.info("MyAspect2 =======after()");
    }
}
